package com.test.wog.util;

import org.springframework.stereotype.Component;

/**
 * @author LX
 * @createDate 2020-01-27
 * @desc 去除geom字段的前置POINT等
 */
@Component
public class GeometryTrimUtil {
    public String trimPoint(String geom){//去除st_astext后，geom中的point(x,x)
        String geomTrimLeft =  "trim(leading 'POINT(' from " + geom + ")";
        String geomTrimRight = "trim(trailing ')' from " + geomTrimLeft + ")";
        return geomTrimRight;
    }

    public String trimLine(String geom){//去除st_astext后，geom中的linestring(x,x)
        String geomTrimLeft =  "trim(leading 'LINESTRING(' from " + geom + ")";
        String geomTrimRight = "trim(trailing ')' from " + geomTrimLeft + ")";
        return geomTrimRight;
    }
}
